/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.rcn.domain;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;

/**
 *
 * @author Nicolas
 */
@Entity
@Table (name="medico")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public class Medico extends Persona{
    private String especialidad;
    private long id;
    /**
     * @return the especialidad
     */
    @Basic
    @Column(name = "especialidad")
    public String getEspecialidad() {
        return especialidad;
    }

    /**
     * @param especialidad the especialidad to set
     */
    public void setEspecialidad(String especialidad) {
        this.especialidad = especialidad;
    }

    /**
     * @return the id
     */
    @GeneratedValue
    @Column(name = "idMedico")
    @Id
    public long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(long id) {
        this.id = id;
    }

    @Override
    public String toString(){
        return this.getNombre()+" "+this.getApellido();
    }
    
    @Override
    public boolean equals(Object medico){
        if(medico instanceof Medico){
            if(((Medico)medico).getId()==this.getId()){
                return true;
            }
        }
        return false;
    }
}
